#ifndef SERIALPORTUDPRX_H
#define SERIALPORTUDPRX_H

#include <QObject>
#include <QUdpSocket>
#include "serialportdefine.h"
#include "serialportglobal.h"
#include "serialportconfig.h"

// UDP报文接收类
class SerialportUdprx : public QObject
{
    Q_OBJECT
public:
    SerialportUdprx(QObject * parent = NULL);
    ~SerialportUdprx();

    // 初始化端口
    void init_port(quint16 port);

signals:
    // 报文响应
    void deliverInfo(QString clientIp);

public slots:
    // 报文接收
    void readDatagrams();

private:
    QUdpSocket * m_udpSocket;
    quint16 m_port;
    QByteArray m_data;
};

#endif // SERIALPORTUDPRX_H
